package com.simpleplayer.contentview;

import android.content.Context;
import android.os.Build;

public class ContentViewFactory {

    public static ContentView createContentView(
            Context context, ContentView.SurfaceListener listener,
            @ContentView.VIEWTYPE int type, @ContentView.RENDERTYPE int render) {
        if (type == ContentView.VIEW_TYPE_SurfaceView) {
            return new ContentSurfaceView(context, listener);
        } else if (type == ContentView.VIEW_TYPE_TextureView) {
            if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O) {
                return new ContentTextureView(context, listener);
            }
        } else if (type == ContentView.VIEW_TYPE_GLSurfaceView) {
            return new ContentGLSurfaceView(context, listener, render);
        }

        return null;
    }
}
